import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

// 配置路由对象
export default new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/home',
      component: () => import('./pages/Home'),
      children: [
        {
          path: 'news',
          component: () => import('./pages/News'),
        },
        {
          path: 'message',
          component: () => import('./pages/Message'),
          children: [
            {
              name: 'd',
              path: 'detail/:id',
              component: () => import('./pages/Detail'),
            },
          ],
        },
      ],
    },
    {
      path: '/about',
      component: () => import('./pages/About'),
    },
    {
      path: '/',
      redirect: '/about',
    },
  ],
})
